import java.util.Arrays;
import java.util.HashSet;
class Solution {
    public boolean isStraight(int[] nums) {
            int max=nums[0];
            int min=Integer.MAX_VALUE;
            HashSet<Integer> set=new HashSet<>();
            for(int i=0;i<nums.length;i++){
                if(nums[i]==0){
                    continue;
                }else if(set.contains(nums[i])){
                    return false;
                }else{
                    if(nums[i]<min){
                        min=nums[i];
                    }
                    if(nums[i]>max){
                        max=nums[i];
                    }
                    set.add(nums[i]);
                }
            }
            return max-min<5?true:false;
        }
    public boolean isStraight1(int[] nums) {
        Arrays.sort(nums);
        int tmp=0;
        for(int i=0;i<nums.length-1;i++){
            if(nums[i]==0){
                tmp++;
            }
            else if(nums[i]==nums[i+1]){
                return false;
            }
        }
        return nums[nums.length-1]-nums[tmp]<5?true:false;
    }
    public int maxValue(int[][] grid) {
        int right=grid[0].length;
        int down=grid.length;
        for(int i=0;i<down;i++){
            for(int j=0;j<right;j++){
                if(i==0&&j==0){
                    continue;
                }
                if(i==0){
                    //第一行和前面的加
                    grid[i][j]+=grid[i][j-1];
                }else if(j==0){
                    //最后一列，和头上方的加
                    grid[i][j]+=grid[i-1][j];
                }else{
                    //前面和头上方的选最大值的进行相加
                    grid[i][j]+=Math.max(grid[i-1][j],grid[i][j-1]);
                }
            }
        }
        return grid[down-1][right-1];
    }
    public int translateNum(int num) {
        int answer=0;
        int a=1,b=1;
        int x,y=num%10;
        while(num>0){
            num=num/10;
            x=num%10;
            int tmp=x*10+y;
            if(tmp>=10&&tmp<=25){
               answer=a+b;
            }else{
                answer=a;
            }
            y=tmp;
            b=a;
            a=answer;
        }
     return answer;
    }
}